import string

class KillmailReader(object):
    #pdb.set_trace()
    def __init__(self):
        self.file = None
        #self.raw_killmailtext = None #deprecated
        self.killmailtext = []
        self.fileName = None
 
    def Open(self, fileName):
        self.fileName = fileName
        if self.isKillMailFile():
            self.file = open("1231243dasf21.rekm")
            self.killmailtext = self.file.readlines()
                    
   
    def PrintRawData(self):
        print self.killmailtext
        
    def GetRawData(self):
        return self.killmailtext
    
    def Close(self):
        self.file.close()
        
    def AddFile(self, fileName = ""):
        if self.file == None:
            self.Open(fileName)
        elif fileName == "":
            return "No file(name) given"
    
    def isKillMailFile(self):
        if self.fileName != None:
            if string.find(self.fileName, ".rekm", len(self.fileName) - 5) > -1:
                return True
            else:
                return False